<?php
if(fazio_option('slider_status') == 'on')
{
	$tag = fazio_option('slider_tag_name');
	$limit = fazio_option('slider_limit');
	
	$featuredPosts = new WP_Query();

	$featuredPosts->query('showposts=' . $limit . '&has_tag=' . $tag);

	if($featuredPosts->have_posts())
	{
	?>
		<div id="slideshowwrap">
			<div id="slideshow">
				<?php
				while ($featuredPosts->have_posts()) : $featuredPosts->the_post();
					$meta = get_post_meta($post->ID, 'featured_image');

					if(isset($meta[0])) : 
				?>
						<a href="<?php the_permalink();?>">
							<img src="<?php echo $meta[0]; ?>" title="<?php echo $post->post_title; ?>" />
							<span>
								<h3><?php echo $post->post_title; ?></h3>
								<?php if(fazio_option('slider_show_excerpt') == 'on' && $post->post_excerpt != '') { ?><p><?php echo $post->post_excerpt; ?></p><?php } ?>
							</span>
						</a>
				<?php
					endif;
				endwhile;
				?>
			</div><!-- end slideshow -->
		</div><!-- end slideshowwrap -->
<?php
	}
}